Python: reintroduce instance-attribute type-tracking without the classInstanceTracker blow-up#22097
Draft
Copilot wants to merge 3 commits into
Draft
Python: reintroduce instance-attribute type-tracking without the classInstanceTracker blow-up#22097Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
Copilot created this pull request from a session on behalf of
owen-mc
June 30, 2026 18:55
View session
Contributor
|
@copilot add a case to one of the existing tests with a MISSING tag which demonstrates the shortcomings of the approach taken in this PR. |
Contributor
Author
Added a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#22092 disabled the
instanceFieldStepdisjunct ofTypeTrackingInput::levelStepCallbecause it identified instances viaclassInstanceTracker— a full type-tracker run — from insidelevelStepCall, creating a mutual recursion that caused catastrophic slowdowns on OOP-heavy code bases (e.g.mypy,dask). This reintroduces the same flow (a value stored onself.attrin a method, read later asinstance.attr) via a cheaper instance-identification strategy.Change
instanceAttrReadnow identifies the instance using local flow (getALocalSource(), purelysimpleLocalFlowStep-based) from a constructor call resolved byresolveClassCall/classTracker, instead ofclassInstanceTracker. This drops the recursive dependency to the same call-graph machinery already used by the un-disabledinheritedFieldStep.instanceFieldStepis otherwise unchanged (samelevelStepCallshape, samegetADirectSuperclass*relation).Trade-off
Precision drops for instances that flow across a call/return before being read — these are no longer covered, since the instance is now tracked only by local flow rather than a dedicated instance type-tracker.
Notes for reviewers
instanceFieldStepare reproduced; typetracking, dataflow, callgraph, ApiGraphs, and taint library tests pass.classTracker+ local flow vs.classInstanceTracker); it was not measured againstmypy/daskin this environment, so confirming the blow-up is resolved on those code bases is worth doing before merge.